package MyList;

import java.util.HashSet;
import java.util.Random;
import java.util.Set;

/**
 * 生成10个不重复的数字
 */
public class NoCopyNumber {
    private static final int MAXCOUNT=10;
    public static void main(String[] args) {
        Random random = new Random();
        Set<Integer> set = new HashSet<>();
        while(set.size()<MAXCOUNT){
            set.add(random.nextInt(11));
        }
        for (Integer integer : set) {
            System.out.println(integer);
        }
    }
}
